const hasPermission = {
  install (Vue, options) {
    Vue.directive('has', {
      bind: function (el, binding) {
        let permissions = window.localStorage.getItem('permissions')
        if (!permissions) {
          el.style.display = 'none'
          el.disabled = true
          el.style.opacity = '0.5'
          console.warn(`没有权限列表`)
          return
        }
        if (permissions && permissions.length && !permissions.includes(binding.value)) {
          el.style.display = 'none'
          el.disabled = true
          el.style.opacity = '0.5'
        }
      }
    })
  }
}
export default hasPermission
